package com.shaokel.pojo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.ws.soap.MTOM;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 少丶客
 * @ClassName Comment
 * @Description TODO
 * @Date 2020/6/23 17:29
 * @Vesion 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "t_comment")
public class Comment {

    @Id
    @GeneratedValue
    private Long id;
    private String nickname;    //昵称
    private String email;       //邮箱
    private String content;     //评论内容
    private String avatar;      //头像
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
    private Date updateTime;

    @ManyToOne      //多对一       comments-->blog      comments是维护端
    private Blog blog;

    @OneToMany(mappedBy = "parentComment")
    private List<Comment> replyComments = new ArrayList<>();

    @ManyToOne
    private Comment parentComment;

    private boolean adminComment;

}